function useMerchantSrc({pathName = '/merchant', hash = '', query = {}}: {pathName: string, hash: string, query: object}) {
    let _host
    const _env = import.meta.env.MODE
    if (_env === 'development') {
        _host = `http://${window.location.hostname}:3000`
    } else if (_env === 'staging') {
        _host = 'https://marketingtest.lianhaikeji.com'
    } else {
        _host = 'https://marketing.lianhaikeji.com'
    }
    
    const _pathname = pathName
    const _hash = hash
    const params = new URLSearchParams()
    params.set('from', 'sass')
    Object.keys(query).forEach(key => {
        params.set(key, query[key])
    })
    const paramString = '?' + params.toString()

    return {
        src: `${_host}${_pathname}${_hash}${paramString}`,
        env: _env,
        host: _host,
        pathname: _pathname,
        params,
        paramString,
    }
}

export default useMerchantSrc
